﻿using Hsp.Auto.Interface;
using System;
using System.Collections.Generic;
using System.Text;

namespace Hsp.Auto.SQLite
{
    public class DbConfigService : SQLiteHelper, IDbConfigService
    {
        private static DataHelper sqlHelper = null;

        static DbConfigService()
        {
            sqlHelper = new DataHelper();
        }

        #region 更新数据库配置数据更新日期

        /// <summary>
        /// 更新数据库配置数据更新日期
        /// </summary>
        /// <param name="id">主键ID</param>
        public void UpLastModified(int id)
        {
            var strSql = $"update DbConfigs set Modified='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' where (id={id});";
            sqlHelper.ExecuteNonQuery(strSql);
        }

        #endregion

        #region 更新输出文件默认存储目录

        /// <summary>
        /// 更新输出文件默认存储目录
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <param name="path">目录</param>
        public void SaveDefaultPath(int id, string path)
        {
            var strSql = $"update ReferenceMaterials set SavePath='{path}' where (id={id});";
            sqlHelper.ExecuteNonQuery(strSql);
        }

        #endregion

    }
}
